const { Model, DataTypes } = require("sequelize");
const sequelize = require("../sequelize.js");

/**
 * 日志
 */
class ActivityLogs extends Model {
  static init() {
    super.init(
      {
        id: {
          type: DataTypes.INTEGER,
          autoIncrement: true,
          primaryKey: true,
        },
        user_id: {
          type: DataTypes.INTEGER,
        },
        path: {
          type: DataTypes.STRING(63),
        },
        client_ip: {
          type: DataTypes.STRING(63),
        },
        user_agent: {
          type: DataTypes.STRING(255),
        },
        created_at: {
          type: DataTypes.DATE,
        },
      },
      {
        sequelize,
        tableName: "activity_logs",
        createdAt: "created_at",
        updatedAt: false,
      }
    );
    return this;
  }
}

ActivityLogs.init();

module.exports = ActivityLogs;
